package com.heima.model.common.dtos;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import java.io.Serializable;

public class PageResponseResult extends ResponseResult implements Serializable {
    private long currentPage;
    private long size;
    private long total;

    public PageResponseResult(long current, long size, long total) {
        this.currentPage = currentPage;
        this.size = size;
        this.total = total;
    }

    public PageResponseResult(Page page) {
        this.currentPage = page.getCurrent();
        this.size = page.getTotal();
        this.total = page.getTotal();
        super.setData(page.getRecords());
    }

    public static ResponseResult okResult(Page page) {
        return new PageResponseResult(page);
    }


    public PageResponseResult() {

    }


    public long getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(long currentPage) {
        this.currentPage = currentPage;
    }

    public long getSize() {
        return size;
    }

    public void setSize(long size) {
        this.size = size;
    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }
}
